boolean displayed = false;

void setup() {
  size(640, 360);
  noSmooth();
  fill(126);
  background(102);
}

void draw(){
}

void mouseClicked(){
  background(102);
  if(!displayed){
    rect(mouseX,mouseY,40, 50);
    displayed = true;
  }else{
    displayed = false;
  }
}

void mouseMoved(){
    if(displayed){
      background(102);
      rect(mouseX,mouseY,40, 50);
    }
}
